console.hide();
sleep(200);
console.show();
//设置接码平台
var sp1 = ui.sp1.getSelectedItemPosition();
if (sp1 == 0) {
    var 接码平台 = "火云"
}
if (sp1 == 1) {
    var 接码平台 = "短租"
}
if (sp1 == 2) {
    var 接码平台 = "共享"
}
if (sp1 == 3) {
    var 接码平台 = "易码"
}
if (sp1 == 4) {
    var 接码平台 = "多米"
}

var 平台账号 = ui.account.text();
var 登陆密码 = ui.password.text();
var 项目ID = ui.xmid.text();

var storage = storages.create("TheHot");
storage.put("username", 平台账号);
storage.put("password", 登陆密码);
storage.put("projectId", 项目ID);

if (ui.xuni.isChecked()) {
    var 虚拟号设置 = "0";
} else if (!ui.xuni.isChecked()) {
    var 虚拟号设置 = "1";
} else {
    var 虚拟号设置 = "";
}

if(!ui.check.isChecked()){
    console.error("请勾选账号检测功能！");
    ele.interrupt();
}

eval(http.get("https://gitee.com/thehot/auto/raw/master/TModules.js").body.string());
eval(http.get("https://gitee.com/thehot/auto/raw/master/items/ele_pro/ele_http_a.js").body.string());

try {
    var r = bmob_register();
    console.info("From.TheHot");
} catch (e) {
    sleep(10);
}

var 手机号 = GetPhone();
if(手机号 == 0){
    console.error("请检查接码平台账户信息！");
    ele.interrupt();
    sleep(3000);
}
var ii = 0;
log("正在获取手机号！");
while (手机号 == 0 && ii < 6) {
    console.error("没有可用号码！");
    var ii = ii + 1;
    var 手机号 = GetPhone();
    sleep(800);
}
if (ii == 6) {
    console.error("无可用号码，请尝试加入对接！");
    ele.interrupt();
}

//账号检测
try {
    if (ui.check.isChecked()) {
        var ckphone = check(手机号);
        var kk = 0;
        while (ckphone != 1 && kk < 6) {
            var kk = kk + 1;
            console.error("手机号已注册！");
            rec(手机号);
            sleep(800);
            手机号 = GetPhone();
            ckphone = check(手机号);
        }
        if (kk == 6) {
            console.error("无可用号码，请更换对接！")
            ele.interrupt();
        } else {
            console.info("成功获取新号：" + 手机号);
            setClip(手机号);
            if(sp1 != 1 ){rec(手机号)};
            console.verbose("注：获取到的号码已复制到剪贴板！")
        }
    }
} catch (e) {
    console.error("号码检测接口出错！");
    ele.interrupt();
}